package com.minhua.jijiehao2.mainframe.mine.updatepasswordactivity.impl

import android.content.Intent
import android.os.Handler
import com.minhua.jijiehao2.R
import com.minhua.jijiehao2.base.BaseActivity
import com.minhua.jijiehao2.mainframe.main.impl.MainActivity
import com.minhua.jijiehao2.mainframe.mine.updatepasswordactivity.imp.IUpdatePasswordView
import com.minhua.jijiehao2.utils.T
import kotlinx.android.synthetic.main.activity_update_password.*

class UpdatePasswordActivity : BaseActivity<IUpdatePasswordView, UpdatePasswordPresenter>(), IUpdatePasswordView {
    override fun getLayoutId(): Int = R.layout.activity_update_password

    override fun getPresenter(): UpdatePasswordPresenter = UpdatePasswordPresenter()

    override fun initView() {
        tvSure.setOnClickListener { mPresenter.updatePassword() }
    }

    override fun getPassword(): String = tvPassword.text.trim()

    override fun getNewPassword(): String = tvNewPassword.text.trim()

    override fun getConfirmPassword(): String = tvConfirmPassword.text.trim()

    override fun onUpdateSuccess() {
        T.showShort("修改密码成功")
        Handler().postDelayed({ startActivity(Intent(this, MainActivity::class.java)) }, 500)

    }
}
